﻿@model QLBV.Models.Menus
@{
    ViewBag.Title = "Thêm menu";
    ViewBag.abc = @Html.DisplayFor(m => m.ID);
    Layout = "~/Views/Shared/_Layout_Manager.cshtml";
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="../../Scripts/Themmenu.js" type="text/javascript"></script>
<div class="HdContent">
 <div class="nav">
    <ul>
        <li class="Unselect"><a href="Menu">Menu</a></li>
        <li class="Selected"><a href="Themmenu">Thêm Menu</a></li>
    </ul>
</div>

<div class="clear"></div>
<div class="Decription">
<p>Ở đây bạn có thể thêm Menu</p>
</div> 
</div>
<div class="MainContent">
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <table>
        <tbody>
            <tr>
                <td>
                     <label>Tên Menu:</label>
                     @Html.EditorFor(model => model.Name)<br />
                     <div class="Alert">@Html.ValidationMessageFor(model => model.Name)</div>
                </td>
                <td>
                     <label>Liên kết:</label>       
                     @Html.EditorFor(model => model.Link)<br />
                     <div class="Alert">@Html.ValidationMessageFor(model => model.Link)</div>
                </td>
            </tr>
            <tr>
                <td>
                    <label>Vị trí:</label>
             @Html.DropDownListFor(model => model.Location, new SelectList(new[] {"1","2"}), new { onchange = "ddListChange()" })
                </td>
                <td>
                <label>Menu Cha:</label>
            @Html.DropDownListFor(m => m.Parent_ID, (IEnumerable<SelectListItem>)ViewBag.List)
                </td>
            </tr>
            <tr>
                <td>
                    <label>Trạng thái:</label>
           @Html.RadioButtonFor(model => model.Status, "True")  Mở
           @Html.RadioButtonFor(model => model.Status, "False")  Đóng<br />
           <div class="Alert">@Html.ValidationMessageFor(model => model.Status)</div>
                </td>
            </tr>
                
        </tbody>
    </table>
    <input type="submit" value="Thêm" id="btnThem"/>
@*    <div class="td" id="Main_Cleft">
       <label>Tên Menu:</label>
            @Html.EditorFor(model => model.Name)
       <label>Liên kết:</label>       
            @Html.EditorFor(model => model.Link)
              
    </div> 

    <div class="td">
        <label>Vị trí:</label>
             @Html.DropDownListFor(model => model.Location, new SelectList(new[] { "1", "2" }))
        <label>Menu Cha:</label>
            @Html.DropDownListFor(m => m.Parent_ID, (IEnumerable<SelectListItem>)ViewBag.List)
             
       </div>
        <div class="td">
           <label>Trạng thái:</label>
           @Html.RadioButtonFor(model => model.Status, "True")  Mở
           @Html.RadioButtonFor(model => model.Status, "False")  Đóng<br />
          
          </div>
         <div class="Alert">
             <ul>
                <li>@Html.ValidationMessageFor(model => model.Name)</li>
                <li>@Html.ValidationMessageFor(model => model.Link)</li>
                <li>@Html.ValidationMessageFor(model => model.Status)</li>
             </ul>
             </div>  
    <input type="submit" value="Thêm" id="btnThem"/>*@
}
</div>
@*<script type="text/javascript">
    //jQuery for the DropDownList(s) Change Event
    $(this.document).ready(function () {
        $('#Location').change(function () //wire up on change event of the 'country' dropdownlist
        {
            //            var selection = $("#Location").val(); //get the selection made in the dropdownlist
            //            $('#Parent_ID').load("/Manager/Themmenu/"+"?vitri=" + selection); //return value of the url /locations/sites which is the action method to invoke.
            var url = "/Home/"

            $.post(url, function (data) {
                // do something if necessary
            });
        })
    });
</script>*@
<script type="text/javascript">

    function ddListChange() {
        alert($("#Location option"))
        // $("Location").val().attr("selected", "selected");
        //        $("#Location option[value='3']").attr("selected", "selected");
        document.location.href = "/Manager/Themmenu/?vitri=" + $('#Location').val();
    }

</script>


